let adminModel = require("../services/adminmodel.js");
module.exports = {
    renderIndex:async ctx=>{
        await ctx.render("adminindex.html");
    },
    renderLogin:async ctx=>{
        await ctx.render("adminlogin.html")
    },
    renderAddnews:async ctx=>{
        await ctx.render("adminaddnews.html")
    },
    checkuser:ctx=>{
        // 调用model
        let username = ctx.request.body.username;
        let pwd = ctx.request.body.pwd;
        let res = adminModel.checkuser(username,pwd);
        let info;
        if(res){
            info = {
                status:1,
                message:"登录成功"
            }
        }else{
            info = {
                status:0,
                message:"登录失败"
            }
        }
        ctx.body = info;
    }

}